]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
overviewControls: split out an util function
authorCosimo Cecchi <cosimoc@gnome.org>
Sat, 16 Feb 2013 01:43:01 +0000 (20:43 -0500)
committerCosimo Cecchi <cosimoc@gnome.org>
Sat, 16 Feb 2013 04:47:12 +0000 (23:47 -0500)
Will be used later

https://bugzilla.gnome.org/show_bug.cgi?id=693924

js/ui/overviewControls.js

index dce5ca1a54c53d8ebb4ed3b3cbe19c75e3d32b4c..cde6bde1a01c60a2da5c2fb7be20f96c34ac9a8e 100644 (file)
@@ -10,6 +10,15 @@ const ViewSelector = imports.ui.viewSelector;
 
 const SIDE_CONTROLS_ANIMATION_TIME = 0.2;
 
+function getRtlSlideDirection(direction, actor) {
+    let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
+    if (rtl)
+        direction = (direction == SlideDirection.LEFT) ?
+            SlideDirection.RIGHT : SlideDirection.LEFT;
+
+    return direction;
+};
+
 const SlideDirection = {
     LEFT: 0,
     RIGHT: 1
@@ -26,17 +35,6 @@ const SlideLayout = new Lang.Class({
         this.parent(params);
     },
 
-    _getRealSlideDirection: function(child) {
-        let direction = this._direction;
-
-        let rtl = (child.text_direction == Clutter.TextDirection.RTL);
-        if (rtl)
-            direction = (direction == SlideDirection.LEFT) ?
-                SlideDirection.RIGHT : SlideDirection.LEFT;
-
-        return direction;
-    },
-
     vfunc_get_preferred_width: function(container, forHeight) {
         let child = container.get_first_child();
 
@@ -55,7 +53,7 @@ const SlideLayout = new Lang.Class({
         let availWidth = Math.round(box.x2 - box.x1);
         let availHeight = Math.round(box.y2 - box.y1);
 
-        let realDirection = this._getRealSlideDirection(child);
+        let realDirection = getRtlSlideDirection(this._direction, child);
         let translationX = (realDirection == SlideDirection.LEFT) ?
             (availWidth - natWidth) : (natWidth - availWidth);